<template>
    <div class="goodsDesc-container">
        <h3>{{ info.title }}</h3>
        <hr>
        <div class="content" v-html="info.content">

        </div>
    </div>
</template>

<script>
    import { Toast } from 'mint-ui'

    export default {
        name: "",
        data(){
            return {
                id: this.$route.params.id,
                info: {}
            }
        },
        created(){
            this.getGoodsDesc()
        },
        methods: {
            getGoodsDesc(){
                this.$http.get('static/data/goodsDesc.json').then(res => {
                    if(res.body.status === 0){
                        var ret = res.body.message.find(item => item.id===parseInt(this.id))
                        if(!ret) return Toast('图文数据获取失败')
                        this.info = ret.goods
                    }
                })
            }
        }
    }
</script>

<style lang="less">
.goodsDesc-container{
    padding: 6px;
    h3{
        font-size: 16px;
        color: #226aff;
        text-align: center;
    }
    .content{
        img{
            width: 100%; /* 要去掉 scoped 才生效 */
        }
    }
}
</style>